﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework.Security
{
    public static class User
    {
        public static int UserID
        {
            get 
            {
                if (System.Web.HttpContext.Current.Session["USER_ID"] == null)
                    return 0;

                return Convert.ToInt32(System.Web.HttpContext.Current.Session["USER_ID"].ToString()); 
            }
            set 
            {
                System.Web.HttpContext.Current.Session.Remove("USER_ID");
                System.Web.HttpContext.Current.Session.Add("USER_ID", value);
            }
        }

        public static string UserName
        {
            get
            {
                return System.Web.HttpContext.Current.Session["USERNAME"].ToString();
            }
            set
            {
                System.Web.HttpContext.Current.Session.Remove("USERNAME");
                System.Web.HttpContext.Current.Session.Add("USERNAME", value);
            }
        }

        public static string Name
        {
            get
            {
                if (System.Web.HttpContext.Current.Session["NAME"] == null)
                    return string.Empty;

                return System.Web.HttpContext.Current.Session["NAME"].ToString();
            }
            set
            {
                System.Web.HttpContext.Current.Session.Remove("NAME");
                System.Web.HttpContext.Current.Session.Add("NAME", value);
            }
        }
    }
}
